home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / game / misc / Garden.lha / Garden / Garden.c < prev    next >
Encoding:
C/C++ Source or Header  |  2002-01-20  |  33.7 KB  |  889 lines

  1. /*  Garden  / Slu4ka v Gradinata                             */
  2. /*  Original Oric BASIC Game by Antoan Hlebarov              */
  3. /*  Amiga C  port by Ventzislav  Tzvetkov                    */
  4. /*  All sources are free to use.                             */
  5. /*  Used the freeware C compiler VBCC by Volker Barthelmann  */
  6. /*  The game is freeware. Enjoy!!                            */
  7.  
  8. #include <intuition/intuition.h>
  9.  
  10. #include <libraries/dos.h>
  11.  
  12. #include <hardware/custom.h>
  13. #include <hardware/cia.h>
  14.  
  15. #define FIRE   1
  16. #define RIGHT  2
  17. #define LEFT   4
  18. #define DOWN   8
  19. #define UP    16
  20.  
  21.  struct FileHandle *file_handle;
  22.  long bytes_written;
  23.  long bytes_read;
  24.  
  25. /* This will automatically be linked to the Custom structure: */
  26. extern struct Custom custom;
  27.  
  28. /* This will automatically be linked to the CIA A (8520) chip: */
  29. extern struct CIA ciaa;
  30.  
  31. UBYTE Joystick();
  32. struct IntuitionBase *IntuitionBase;
  33. struct GfxBase *GfxBase;
  34.  
  35. struct Screen *my_screen;
  36. struct Window *my_window;
  37.  
  38. int n,x,y,a,b,mx,my,xd,yd;
  39.  
  40. UBYTE Title1[]={254,254,198,184,202,218,182,160,254,254,206,254,254,174,196,160,168,178,188,160,200,160,254},
  41. Title2[]={255,255,199,185,203,219,183,161,255,255,207,255,255,175,197,161,169,179,189,161,201,161,255};
  42. struct IntuiMessage *my_message;
  43.  
  44. /******************************************/
  45. /*     FontData prepared by PrintFont     */
  46. /*     ------------------------------     */
  47. /* Anders Bjerin             Amiga C Club */
  48. /*                                        */
  49. /* Font name:                    hap.font */
  50. /* Struct name:                       Hap */
  51. /* Height:                              8 */
  52. /* Characters:                   32 - 255 */
  53. /******************************************/
  54. /* The font data: */
  55. static UWORD HapData[616]=
  56. {
  57.   /* Row 0: */
  58.   0x0045,0x0A10,0x039E,0x036F,0xD600,0x0000,0x3843,0x9F09,
  59.   0xF1DF,0x38E0,0x0008,0x020E,0x38E7,0xD219,0xF11F,0x4515,
  60.   0x511D,0x144E,0x7CF7,0x8E7D,0x155E,0x4303,0x9581,0x5452,
  61.   0x1800,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  62.   0x0000,0x0000,0x0010,0x0003,0xDB61,0x8053,0xF061,0xF800,
  63.   0x00FD,0x2AB7,0x0007,0xC003,0xEE10,0x4191,0x8E39,0x17D1,
  64.   0x7924,0x8629,0x0115,0x7D04,0x4A45,0x9551,0x5072,0x5144,
  65.   0xE45F,0x3D03,0x907C,0x4441,0x5554,0x3038,0x1555,0x5414,
  66.   0x9500,0xA000,0xFD5F,0x2000,0x093F,0x000D,0xFFFF,0xF700,
  67.   0x000F,0x9803,0x0FF0,0xC3F0,0x0000,
  68.   /* Row 1: */
  69.   0x0045,0x0A3D,0x157F,0x03E8,0x5F00,0x0001,0x44C4,0x4119,
  70.   0x0201,0x4511,0x0410,0x0111,0x4514,0x1229,0x0390,0x4514,
  71.   0x5225,0xB451,0x4514,0x5111,0x1551,0x4104,0x5541,0x5455,
  72.   0x1800,0x0000,0x0000,0x0001,0x0000,0x0000,0x0000,0x0000,
  73.   0x0000,0x0000,0x0010,0x000F,0xDB60,0xC093,0xF0C1,0xF803,
  74.   0x60FC,0x9548,0x0C68,0x1F3C,0x2A1F,0x7DF1,0x8E39,0x17D1,
  75.   0x7924,0x8629,0x0115,0x7D04,0x4A45,0x9551,0x5072,0x5144,
  76.   0xE45F,0x3D03,0x907C,0x4441,0x5554,0x3038,0x1555,0x5414,
  77.   0x95C5,0xF545,0x7DFF,0x1000,0x4DBF,0x004F,0xFFFF,0xFF80,
  78.   0x000F,0x0C06,0x8FC0,0x03F0,0x0100,
  79.   /* Row 2: */
  80.   0x0040,0x1F42,0xA39E,0x0148,0x4F00,0x0003,0x4C40,0x4229,
  81.   0xE402,0x4511,0x0421,0xF081,0x5D14,0x1229,0x0550,0x2934,
  82.   0xD425,0x5451,0x4514,0x5011,0x1551,0x4100,0x5521,0x5455,
  83.   0x0CE7,0xD218,0xE11F,0x8924,0x921D,0xB48E,0x7CF7,0x8E7D,
  84.   0x155E,0x4183,0x9511,0x54BC,0xF880,0x409F,0xF183,0xF807,
  85.   0xF001,0x2577,0x31FB,0xD940,0x2B90,0x4190,0x0045,0x1411,
  86.   0x4524,0x8A7D,0x038E,0x4104,0x5145,0x1452,0x4892,0x5B45,
  87.   0x1451,0x4504,0x5110,0x4441,0x5554,0x1045,0x1555,0x5415,
  88.   0x55EF,0xFFCF,0xFFFF,0x8800,0x6FFF,0x006F,0xFFFF,0xE000,
  89.   0x001E,0x020C,0x0FC0,0x03F0,0x2900,
  90.   /* Row 3: */
  91.   0x0040,0x0A39,0x410C,0x03E8,0x5F01,0xF006,0x5441,0x8648,
  92.   0x1784,0x38F0,0x0040,0x0042,0x55F7,0x9229,0xE550,0x1155,
  93.   0x5825,0x57D1,0x44F7,0x9010,0xF7DE,0x79E1,0x9511,0x53DD,
  94.   0x0014,0x1229,0x1390,0x5124,0x9425,0xF491,0x4594,0x5111,
  95.   0x1551,0x4080,0x5511,0x5570,0xF880,0x009F,0x1103,0x980F,
  96.   0xF800,0x9A88,0xC3FB,0xD958,0x389F,0x4193,0xDF45,0x1411,
  97.   0x4524,0x8A7D,0x038E,0x4104,0x5145,0x1452,0x4892,0x5B45,
  98.   0x1451,0x4504,0x5110,0x4441,0x5554,0x1045,0x1555,0x5415,
  99.   0x553F,0xFFDF,0x7FFF,0xDC01,0x7FFF,0x027F,0xF87F,0xCF80,
  100.   0x0032,0x0218,0x0CC0,0x83F0,0x3300,
  101.   /* Row 4: */
  102.   0x0040,0x1F04,0xA7FF,0x0368,0x4F00,0x000C,0x6442,0x017C,
  103.   0x1448,0x4410,0x0021,0xF084,0x5D14,0x5229,0x0550,0x2996,
  104.   0x5425,0x1451,0x4514,0x1010,0x1551,0x4510,0x5509,0x5055,
  105.   0x00F7,0x9229,0xF550,0x2165,0x9825,0x5791,0x44F7,0x9010,
  106.   0xF7DE,0x78E1,0x9511,0x5743,0x52B0,0x005E,0x1007,0x180F,
  107.   0xF801,0x2AB7,0xC3FB,0xD958,0x0ED0,0x4195,0xAE45,0x141E,
  108.   0x4527,0xCA45,0xF544,0x4102,0x914D,0x14D4,0x4494,0x5545,
  109.   0x1391,0x4504,0x0E10,0x444E,0x5554,0x1004,0xE55F,0x7C15,
  110.   0x527F,0xFFFF,0xFFF0,0x0803,0x7FFF,0x037F,0xF003,0x8F80,
  111.   0x0072,0x0230,0x0CC0,0xC310,0x3F00,
  112.   /* Row 5: */
  113.   0x0000,0x0A79,0x539E,0x5488,0x5F18,0x0198,0x4444,0x1109,
  114.   0x1448,0x4421,0x0410,0x0100,0x4114,0x527D,0x0390,0x4514,
  115.   0x5225,0x1451,0x4514,0x1110,0x1551,0x4514,0x5505,0x5055,
  116.   0x0194,0x527D,0x0390,0x51A6,0x9425,0x1491,0x4454,0x1110,
  117.   0x1551,0x4490,0x5511,0x554F,0x52B0,0x7053,0xF007,0x184F,
  118.   0xF800,0x9548,0x31F8,0x1940,0x021F,0x7DF1,0x8E45,0x141E,
  119.   0x4527,0xCA45,0xF544,0x4102,0x914D,0x14D4,0x4494,0x5545,
  120.   0x1391,0x4504,0x0E10,0x444E,0x5554,0x1004,0xE55F,0x7C15,
  121.   0x52E7,0xFFDF,0x7FF0,0x0413,0xFFFF,0x03FC,0x7003,0x8F80,
  122.   0x00FE,0x0260,0x0CC0,0xE300,0x1E00,
  123.   /* Row 6: */
  124.   0x0040,0x0A12,0x229E,0xAAB8,0x5618,0x01B0,0x38E7,0xCE08,
  125.   0xE388,0x38C1,0x0408,0x0204,0x3D17,0x9F45,0xF110,0x4514,
  126.   0x5145,0x144E,0x4514,0x0E10,0xE55E,0x79E3,0x9F01,0xF052,
  127.   0x00F7,0x9F44,0xF110,0x8924,0x9245,0x148E,0x4494,0x0E10,
  128.   0xE55E,0x78E3,0x9F11,0xF4BC,0xF9E0,0x1873,0xF007,0x38C7,
  129.   0xF0FD,0x2577,0x0C67,0xDF3C,0x0390,0x4192,0x517C,0x0780,
  130.   0x7920,0x4A00,0x0540,0x4001,0x0054,0x0558,0x0090,0x157D,
  131.   0x1011,0x3D04,0x0010,0x03C0,0x7C07,0x9E18,0x0540,0x0407,
  132.   0x40C7,0xFFFF,0xFFF0,0x031B,0xFFFF,0x07F0,0x7803,0xC700,
  133.   0x05CF,0x0CC0,0x1DC0,0xE300,0x4C00,
  134.   /* Row 7: */
  135.   0x0000,0x0000,0x02B3,0x01EF,0xC030,0x0000,0x0000,0x0000,
  136.   0x0000,0x0000,0x0800,0x0000,0x0000,0x0100,0x0000,0x0000,
  137.   0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x1000,
  138.   0x0000,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  139.   0x0000,0x0000,0x0000,0x1000,0xF9E0,0x0CD3,0xF00E,0x7943,
  140.   0xE0FC,0x9A88,0x0000,0x0000,0x00DF,0x4194,0x117C,0x0780,
  141.   0x7920,0x4A00,0x0540,0x4001,0x0054,0x0558,0x0090,0x157D,
  142.   0x1011,0x3C04,0x0010,0x03C0,0x7C07,0x9E18,0x0540,0x0407,
  143.   0x40F9,0xF7DF,0x7FF0,0x039F,0xFFFF,0x1F80,0x7E03,0xEFF0,
  144.   0x038F,0x9880,0x3FC0,0xC300,0xC000
  145. };
  146.  
  147. /* The location and width of each character: */
  148. static ULONG HapLoc[224]=
  149. {
  150.   0x00000006,0x00060006,0x000C0006,0x00120006,
  151.   0x00180006,0x001E0006,0x00240006,0x002A0006,
  152.   0x00300006,0x00360006,0x003C0006,0x00420006,
  153.   0x00480006,0x004E0006,0x00540006,0x005A0006,
  154.   0x00600006,0x00660006,0x006C0006,0x00720006,
  155.   0x00780006,0x007E0006,0x00840006,0x008A0006,
  156.   0x00900006,0x00960006,0x009C0006,0x00A20006,
  157.   0x00A80006,0x00AE0006,0x00B40006,0x00BA0006,
  158.   0x00C00006,0x00C60006,0x00CC0006,0x00D20006,
  159.   0x00D80006,0x00DE0006,0x00E40006,0x00EA0006,
  160.   0x00F00006,0x00F60006,0x00FC0006,0x01020006,
  161.   0x01080006,0x010E0006,0x01140006,0x011A0006,
  162.   0x01200006,0x01260006,0x012C0006,0x01320006,
  163.   0x01380006,0x013E0006,0x01440006,0x014A0006,
  164.   0x01500006,0x01560006,0x015C0006,0x01620006,
  165.   0x01680006,0x016E0006,0x01740006,0x017A0006,
  166.   0x01800006,0x01860006,0x018C0006,0x01920006,
  167.   0x01980006,0x019E0006,0x01A40006,0x01AA0006,
  168.   0x01B00006,0x01B60006,0x01BC0006,0x01C20006,
  169.   0x01C80006,0x01CE0006,0x01D40006,0x01DA0006,
  170.   0x01E00006,0x01E60006,0x01EC0006,0x01F20006,
  171.   0x01F80006,0x01FE0006,0x02040006,0x020A0006,
  172.   0x02100006,0x02160006,0x021C0006,0x02220006,
  173.   0x02280006,0x022E0006,0x02340006,0x023A0006,
  174.   0x02400006,0x02460006,0x024C0006,0x02520006,
  175.   0x02580006,0x025E0006,0x02640006,0x026A0006,
  176.   0x02700006,0x02760006,0x027C0006,0x02820006,
  177.   0x02880006,0x02880006,0x028E0006,0x02940006,
  178.   0x029A0006,0x02A00006,0x02A60006,0x02AC0006,
  179.   0x02B20006,0x02B20006,0x02B20006,0x02B20006,
  180.   0x02B80006,0x02BE0006,0x02C40006,0x02CA0006,
  181.   0x02D00006,0x02D60006,0x02DC0006,0x02E20006,
  182.   0x02E80006,0x02EE0006,0x02F40006,0x02FA0006,
  183.   0x03000006,0x02FA0006,0x03060006,0x030C0006,
  184.   0x03120006,0x03180006,0x02F40006,0x031E0006,
  185.   0x03240006,0x032A0006,0x03300006,0x03360006,
  186.   0x033C0006,0x03420006,0x03480006,0x034E0006,
  187.   0x03540006,0x034E0006,0x035A0006,0x03600006,
  188.   0x03660006,0x036C0006,0x03720006,0x02EE0006,
  189.   0x03780006,0x02EE0006,0x037E0006,0x03840006,
  190.   0x038A0006,0x02EE0006,0x03900006,0x02EE0006,
  191.   0x03000006,0x03960006,0x039C0006,0x03A20006,
  192.   0x03A80006,0x03AE0006,0x03B40006,0x03BA0006,
  193.   0x03C00006,0x03C60006,0x03000006,0x02FA0006,
  194.   0x03CC0006,0x02FA0006,0x03D20006,0x02FA0006,
  195.   0x03D80006,0x03DE0006,0x03E40006,0x03EA0006,
  196.   0x03E40006,0x03F00006,0x03B40006,0x03F60006,
  197.   0x03FC0006,0x04020006,0x04080006,0x040E0006,
  198.   0x04140006,0x041A0006,0x04200006,0x04260006,
  199.   0x042C0006,0x04320006,0x04380006,0x043E0006,
  200.   0x04440006,0x044A0006,0x04500006,0x04560006,
  201.   0x045C0006,0x04620006,0x04680006,0x046E0006,
  202.   0x04740006,0x047A0006,0x04800006,0x04860006,
  203.   0x048C0006,0x04920006,0x04980006,0x049E0006,
  204.   0x04A40006,0x04AA0006,0x04B00006,0x04B60006,
  205.   0x04BC0006,0x04C20006,0x00000006,0x00000006
  206. };
  207.  
  208. /* The text font structure: */
  209. struct TextFont HapFont=
  210. {
  211.   { /* Message */
  212.     { /* Node */
  213.       NULL,    /* ln_Succ */
  214.       NULL,    /* ln_Pred */
  215.       NT_FONT, /* ln_Type */
  216.       0,       /* ln_Pri */
  217.       "hap.font" /* ln_Name */
  218.     },
  219.     NULL,      /* mn_ReplyPort */
  220.      2132      /* mn_Length */
  221.   },
  222.       8, /* tf_YSize */
  223.       0, /* tf_Style */
  224.      66, /* tf_Flags */
  225.       6, /* tf_XSize */
  226.       6, /* tf_Baseline */
  227.       1, /* tf_BoldSmear */
  228.       0, /* tf_Accessors */
  229.      32, /* tf_LoChar */
  230.     255, /* tf_HiChar */
  231.   (APTR) &HapData,  /* tf_CharData */
  232.     154, /* tf_Modulo */
  233.   (APTR) &HapLoc,   /* tf_CharLoc */
  234.    NULL, /* tf_CharSpace */
  235.    NULL, /* tf_CharKern */
  236. };
  237.  
  238. /******************************************/
  239.  
  240. /* The body text for the about info: */
  241.  
  242. /* Gadgets */
  243. struct Gadget my_first_gadget=
  244. {
  245.   NULL,          /* NextGadget, no more gadgets in the list. */
  246.   180,           /* LeftEdge, 180 pixels out. */
  247.   64,            /* TopEdge, 20 lines down. */
  248.   12,            /* Width, 12 pixels wide. */
  249.   16,            /* Height, 16 pixels lines heigh. */
  250.   GADGHNONE,     /* Flags, no highlighting. */
  251.   GADGIMMEDIATE, /* When the user selects the gadget*/
  252.                  /* has released it. */ 
  253.   BOOLGADGET,    /* GadgetType, a Boolean gadget. */
  254.   NULL,
  255.   NULL,          /* SelectRender */
  256.   NULL,          /* GadgetText, a pointer to our IntuiText structure. */
  257.   NULL,          /* MutualExclude, no mutual exclude. */
  258.   NULL,          /* SpecialInfo, NULL since this is a Boolean gadget. */
  259.                  /* (It is not a Proportional/String or Integer gdget) */
  260.   0,             /* GadgetID, no id. */
  261.   NULL           /* UserData, no user data connected to the gadget. */
  262. };
  263.  
  264. struct Gadget my_second_gadget=
  265. {
  266.   &my_first_gadget, /* NextGadget, after this comes my_first_gadget. */
  267.   180,           /* LeftEdge, 180 pixels out. */
  268.   96,            /* TopEdge, 20 lines down. */
  269.   12,            /* Width, 12 pixels wide. */
  270.   16,            /* Height, 16 pixels lines heigh. */
  271.   GADGHNONE,     /* Flags, no highlighting. */
  272.   GADGIMMEDIATE, /* When the user selects the gadget*/
  273.                  /* has released it. */ 
  274.   BOOLGADGET,    /* GadgetType, a Boolean gadget. */
  275.   NULL,
  276.   NULL,          /* SelectRender */
  277.   NULL,          /* GadgetText, a pointer to our IntuiText structure. */
  278.   NULL,          /* MutualExclude, no mutual exclude. */
  279.   NULL,          /* SpecialInfo, NULL since this is a Boolean gadget. */
  280.                  /* (It is not a Proportional/String or Integer gdget) */
  281.   0,             /* GadgetID, no id. */
  282.   NULL           /* UserData, no user data connected to the gadget. */
  283. };
  284.  
  285. struct Gadget my_third_gadget=
  286. {
  287.   &my_second_gadget,/* NextGadget, after this comes my_first_gadget. */
  288.   180,           /* LeftEdge, 180 pixels out. */
  289.   128,            /* TopEdge, 20 lines down. */
  290.   12,            /* Width, 12 pixels wide. */
  291.   16,            /* Height, 16 pixels lines heigh. */
  292.   GADGHNONE,     /* Flags, no highlighting. */
  293.   GADGIMMEDIATE, /* When the user selects the gadget*/
  294.                  /* has released it. */ 
  295.   BOOLGADGET,    /* GadgetType, a Boolean gadget. */
  296.   NULL,
  297.   NULL,          /* SelectRender */
  298.   NULL,          /* GadgetText, a pointer to our IntuiText structure. */
  299.   NULL,          /* MutualExclude, no mutual exclude. */
  300.   NULL,          /* SpecialInfo, NULL since this is a Boolean gadget. */
  301.                  /* (It is not a Proportional/String or Integer gdget) */
  302.   0,             /* GadgetID, no id. */
  303.   NULL           /* UserData, no user data connected to the gadget. */
  304. };
  305. /* Text for the About Menu Item */
  306. struct IntuiText my_body_text=
  307. {
  308.   0,       /* FrontPen, colour 0 (blue). */
  309.   0,       /* BackPen, not used since JAM1. */
  310.   JAM1,    /* DrawMode, do not change the background. */
  311.   15,      /* LedtEdge, 15 pixels out. */
  312.   5,       /* TopEdge, 5 lines down. */
  313.   NULL,    /* ITextFont, default font. */
  314.   "Copyright © 2002", /* IText, the text . */
  315.   NULL,    /* NextText, no more IntuiText structures link. */
  316. };
  317.  
  318. /* The OK text: */
  319. struct IntuiText my_ok_text=
  320. {
  321.   0,       /* FrontPen, colour 0 (blue). */
  322.   0,       /* BackPen, not used since JAM1. */
  323.   JAM1,    /* DrawMode, do not change the background. */
  324.   6,       /* LedtEdge, 6 pixels out. */
  325.   3,       /* TopEdge, 3 lines down. */
  326.   NULL,    /* ITextFont, default font. */
  327.   "OK",    /* IText, the text that will be printed. */
  328.   NULL,    /* NextText, no more IntuiText structures link. */
  329. };
  330.  
  331. /* Game's Screen */
  332. struct NewScreen my_new_screen=
  333. {
  334.   0,            /* LeftEdge  Should always be 0. */
  335.   0,            /* TopEdge   Top of the display.*/
  336.   320,          /* Width     We are using a low-resolution screen. */
  337.   256,          /* Height    Non-Interlaced PAL (European) display. */
  338.   3,            /* Depth     8 colours. */
  339.   0,            /* DetailPen Text should be drawn with colour reg. 0 */
  340.   1,            /* BlockPen  Blocks should be drawn with colour reg. 1 */
  341.   NULL,         /* ViewModes No special modes. (Low-res, Non-Interlaced) */
  342.   CUSTOMSCREEN, /* Type      Your own customized screen. */
  343.   NULL,         /* Font      Default font. */
  344.   "Garden",/* Title The screen' title. */
  345.   NULL,         /* Gadget    Must for the moment be NULL. */
  346.   NULL          /* BitMap    No special CustomBitMap. */
  347. };
  348.  
  349. struct NewWindow my_new_window=
  350. {
  351.   0,            /* LeftEdge    x position of the window. */
  352.   0,            /* TopEdge     y positio of the window. */
  353.   320,           /* Width       150 pixels wide. */
  354.   256,           /* Height      100 lines high. */
  355.   0,             /* DetailPen   Text should be drawn with colour reg. 0 */
  356.   1,             /* BlockPen    Blocks should be drawn with colour reg. 1 */
  357.   MENUPICK, /* IDCMPFlags. */
  358.   SMART_REFRESH|BORDERLESS|ACTIVATE, /* Flags       Intuition should refresh the window. */ 
  359.   &my_third_gadget,/* FirstGadget. */
  360.   NULL,          /* CheckMark   Use Intuition's default CheckMark (v). */
  361.   NULL,          /* Title       Title of the window. */
  362.   NULL,          /* Screen      Connected to the Workbench Screen. */
  363.   NULL,          /* BitMap      No Custom BitMap. */
  364.   0,0,0,0,
  365.   CUSTOMSCREEN   /* Type        Connected to custom Screen. */
  366. };
  367.  
  368. struct IntuiText my_third_text=
  369. {
  370.   2,          /* FrontPen, black. */
  371.   0,          /* BackPen, not used since JAM1. */
  372.   JAM1,       /* DrawMode, do not change the background. */
  373.   0,          /* LeftEdge, CHECKWIDTH amount of pixels out. */
  374.               /* This will leave enough space for the check mark. */
  375.   1,          /* TopEdge, 1 line down. */
  376.   NULL,       /* TextAttr, default font. */
  377.   "Quit",     /* IText, the string. */
  378.   NULL        /* NextItem, no link to other IntuiText structures. */
  379. };
  380.  
  381. struct MenuItem my_third_item=
  382. {
  383.   NULL, /* &my_third_item, */  /* NextItem, linked to the third item. */
  384.   0,               /* LeftEdge, 0 pixels out. */
  385.   20,              /* TopEdge, 10 lines down. */
  386.   150,             /* Width, 150 pixels wide. */
  387.   10,              /* Height, 10 lines high. */
  388.   ITEMTEXT|        /* Flags, render this item with text. */
  389.   ITEMENABLED|     /*        this item will be enabled. */
  390.   COMMSEQ|         /*        accessible from the keyboard. */
  391.   HIGHCOMP,        /*        complement the colours when highlihted. */
  392.   0x00000000,      /* MutualExclude, mutualexclude the first item only. */
  393.   (APTR) &my_third_text, /* ItemFill, pointer to the text. */
  394.   NULL,            /* SelectFill, nothing since we complement the col. */
  395.   'Q',               /* Command, no command-key sequence. */
  396.   NULL,            /* SubItem, no subitem list. */
  397.   MENUNULL,        /* NextSelect, no items selected. */
  398. };
  399.  
  400. struct IntuiText my_second_text=
  401. {
  402.   2,          /* FrontPen, black. */
  403.   0,          /* BackPen, not used since JAM1. */
  404.   JAM1,       /* DrawMode, do not change the background. */
  405.   0,          /* LeftEdge, CHECKWIDTH amount of pixels out. */
  406.               /* This will leave enough space for the check mark. */
  407.   1,          /* TopEdge, 1 line down. */
  408.   NULL,       /* TextAttr, default font. */
  409.   "About",    /* IText, the string. */
  410.   NULL        /* NextItem, no link to other IntuiText structures. */
  411. };
  412.  
  413. struct MenuItem my_second_item=
  414. {
  415.   &my_third_item,  /* NextItem, linked to the third item. */
  416.   0,               /* LeftEdge, 0 pixels out. */
  417.   10,              /* TopEdge, 10 lines down. */
  418.   150,             /* Width, 150 pixels wide. */
  419.   10,              /* Height, 10 lines high. */
  420.   ITEMTEXT|        /* Flags, render this item with text. */
  421.   ITEMENABLED|     /*        this item will be enabled. */
  422.   COMMSEQ|         /*        accessible from the keyboard. */
  423.   HIGHCOMP,        /*        complement the colours when highlihted. */
  424.   0x00000000,      /* MutualExclude, mutualexclude the first item only. */
  425.   (APTR) &my_second_text, /* ItemFill, pointer to the text. */
  426.   NULL,            /* SelectFill, nothing since we complement the col. */
  427.   'A',               /* Command, no command-key sequence. */
  428.   NULL,            /* SubItem, no subitem list. */
  429.   MENUNULL,        /* NextSelect, no items selected. */
  430. };
  431.  
  432. struct IntuiText my_first_text=
  433. {
  434.   2,          /* FrontPen, black. */
  435.   0,          /* BackPen, not used since JAM1. */
  436.   JAM1,       /* DrawMode, do not change the background. */
  437.   0, /* LeftEdge, CHECKWIDTH amount of pixels out. */
  438.               /* This will leave enough space for the check mark. */
  439.   1,          /* TopEdge, 1 line down. */
  440.   NULL,       /* TextAttr, default font. */
  441.   "New Game", /* IText, the string. */
  442.   NULL        /* NextItem, no link to other IntuiText structures. */
  443. };
  444.  
  445. struct MenuItem my_first_item=
  446. {
  447.   &my_second_item, /* NextItem, linked to the second item. */
  448.   0,               /* LeftEdge, 0 pixels out. */
  449.   0,               /* TopEdge, 0 lines down. */
  450.   150,             /* Width, 150 pixels wide. */
  451.   10,              /* Height, 10 lines high. */
  452.   ITEMTEXT|        /* Flags, render this item with text. */
  453.   ITEMENABLED|     /*        this item will be enabled. */
  454.   COMMSEQ|         /*        accessible from the keyboard. */
  455.   HIGHCOMP,        /*        complement the colours when highlihted. */
  456.   0x00000000,      /* MutualExclude, , no mutualexclude. */
  457.   (APTR) &my_first_text, /* ItemFill, pointer to the text. */
  458.   NULL,            /* SelectFill, nothing since we complement the col. */
  459.   'N',             /* Command, no command-key sequence. */
  460.   NULL,            /* SubItem, no subitem list. */
  461.   MENUNULL,        /* NextSelect, no items selected. */
  462. };
  463.  
  464. struct Menu my_menu=
  465. {
  466.   NULL,          /* NextMenu, no more menu structures. */
  467.   0,             /* LeftEdge, left corner. */
  468.   0,             /* TopEdge, for the moment ignored by Intuition. */
  469.   50,            /* Width, 50 pixels wide. */
  470.   0,             /* Height, for the moment ignored by Intuition. */
  471.   MENUENABLED,   /* Flags, this menu will be enabled. */
  472.   "Garden",/* MenuName, the string. */
  473.   &my_first_item /* FirstItem, pointer to the first item in the list. */
  474. };
  475.  
  476.  
  477. main()
  478. {
  479.  BOOL close=0;
  480.  int l=10,bs,hiscore[2]={0,0},i,Score=0;
  481.  char score[5]={48,48,48,48,48},bar=42;
  482.  
  483. /* Opens the highscore file */
  484.  
  485. file_handle = (struct FileHandle *)
  486. Open( "GardenHighscores.sav", MODE_READWRITE );
  487. Seek( file_handle, 0, OFFSET_BEGINNING );
  488.  
  489. bytes_read = Read( file_handle, hiscore, sizeof( hiscore ) );
  490.  
  491.  
  492.  
  493. /* Open the Intuition library: */
  494.  
  495.   IntuitionBase = (struct IntuitionBase *)
  496.     OpenLibrary( "intuition.library", 0 );
  497.   if( !IntuitionBase )
  498.     exit();
  499. /* Open the Graphics library: */
  500.   GfxBase = (struct GfxBase *)
  501.     OpenLibrary( "graphics.library", 0 );
  502.   if( !GfxBase )
  503.   {
  504.   CloseLibrary( IntuitionBase );
  505.   exit();    
  506.   }
  507.  
  508. /* We will now try to open the screen: */
  509.  
  510.  
  511.  my_screen = (struct Screen *) OpenScreen( &my_new_screen );
  512.   if( !my_screen )
  513.   {
  514.    CloseLibrary( GfxBase );
  515.    CloseLibrary( IntuitionBase );
  516.    exit();
  517.    }
  518.  SetRGB4( &my_screen->ViewPort, 0,  0,0,0   );
  519.  SetRGB4( &my_screen->ViewPort, 1,  0,0,15  );
  520.  SetRGB4( &my_screen->ViewPort, 2,  6,6,15  );
  521.  SetRGB4( &my_screen->ViewPort, 3,  15,0,0 );
  522.  SetRGB4( &my_screen->ViewPort, 4,  7,3,0  );
  523.  SetRGB4( &my_screen->ViewPort, 5,  0,15,9 );
  524.  SetRGB4( &my_screen->ViewPort, 6,  0,11,15 );
  525.  SetRGB4( &my_screen->ViewPort, 7,  15,15,0);
  526.  
  527.  my_new_window.Screen = my_screen;
  528.  my_window = (struct Window *) OpenWindow( &my_new_window );
  529.  
  530. if ( !my_window )
  531.   {
  532.     /* Could NOT open the Window! */
  533.     
  534.     /* Close the Intuition Library since we have opened it: */
  535.    CloseScreen( my_screen );
  536.    CloseLibrary( GfxBase );   
  537.    CloseLibrary( IntuitionBase );
  538.    exit();
  539.   }
  540. SetFont( my_window->RPort, &HapFont );
  541. Title();
  542. SetMenuStrip( my_window, &my_menu );
  543.   /* Stay in the while loop until the end */
  544.  
  545.   while( close == FALSE )
  546.   {
  547. x=36;y=5;mx=l;my=5;xd=1;yd=0;n=0;
  548. SetAPen(my_window->RPort,0);
  549. RectFill(my_window->RPort,0,0,319,255);
  550. SetAPen(my_window->RPort,4);
  551. Move( my_window->RPort,24,8); Text( my_window->RPort, "Rezultat",8);
  552. Move( my_window->RPort,144,8); Text( my_window->RPort, "Rekord",8);
  553. bs=Score;
  554. score[0]=(bs/10000)+48;bs=bs%10000;
  555. score[1]=(bs/1000)+48;bs=bs%1000;
  556. score[2]=(bs/100)+48;bs=bs%100;
  557. score[3]=(bs/10)+48;bs=bs%10;
  558. score[4]=bs+48;
  559. Move( my_window->RPort,78,8); Text( my_window->RPort, &score[0],5);
  560. bs=hiscore[1];
  561. score[0]=(bs/10000)+48;bs=bs%10000;
  562. score[1]=(bs/1000)+48;bs=bs%1000;
  563. score[2]=(bs/100)+48;bs=bs%100;
  564. score[3]=(bs/10)+48;bs=bs%10;
  565. score[4]=bs+48;
  566.  
  567. Move( my_window->RPort,186,8); Text( my_window->RPort, &score[0],5);
  568. SetAPen(my_window->RPort,1);
  569. for (i=4; i<38; i++) {Move ( my_window->RPort,i*6,32);Text( my_window->RPort, &bar,1);Move ( my_window->RPort,246-i*6,168);Text( my_window->RPort, &bar,1);} for (i=4; i<38; i=i+2) {Move ( my_window->RPort,24,16+i*4);Text( my_window->RPort, &bar,1);Move ( my_window->RPort,222,184-i*4);Text( my_window->RPort, &bar,1);}
  570. SetAPen(my_window->RPort,5);
  571. for (i=6; i<21; i++) {Move ( my_window->RPort,30,i*8);Text( my_window->RPort, "((((((((((((((((((((((((((((((((",32);
  572. }
  573.  
  574. SetAPen(my_window->RPort,6);
  575.  
  576. for (i=1; i<21; i++){
  577. Move (my_window->RPort,30+(rand()%32)*6,48+(rand()%15)*8);
  578. Text( my_window->RPort, &bar,1);
  579. }
  580.  
  581. SetAPen(my_window->RPort,2);
  582. i=0;
  583.  
  584. while (i<l) {
  585. a=rand()%32;
  586. b=rand()%15;
  587. if ( ReadPixel(my_window->RPort,30+a*6,48+b*8)==5 && a!=32 && b!=1) {Move (my_window->RPort,30+a*6,48+b*8);
  588. Text (my_window->RPort, ")",1);
  589. i++;}
  590. }
  591.  
  592. SetAPen(my_window->RPort,7);
  593. Move (my_window->RPort,x*6,y*8);
  594. Text (my_window->RPort, "&",1);     /* That's You! */
  595. SetAPen(my_window->RPort,3);
  596. Move (my_window->RPort,mx*6,my*8);
  597. Text (my_window->RPort, "'",1);     /* This is Zorak */
  598. while (1) {a=Joystick(); if (a==LEFT || a==RIGHT || a==UP  || a==DOWN ) break; my_message = (struct IntuiMessage *) GetMsg(my_window->UserPort);
  599.     if (close)
  600.        break;
  601.  
  602.       /* After we have successfully collected the message we can read */
  603.       /* it, and save any important values which we maybe want to check */
  604.       /* later: */
  605.  
  606. if(my_message->Class == MENUPICK && my_message->Code == 63488)
  607. {Score=0;l=10;i=500;break;} /* New Game */
  608.  if(my_message->Class == MENUPICK && my_message->Code == 63520)
  609.  AutoRequest( my_window, &my_body_text, NULL, &my_ok_text, NULL, NULL, 220, 72);  /* About */
  610.  
  611.  if(my_message->Class == MENUPICK && my_message->Code == 63552)
  612.    {
  613. close=TRUE; /* Quit */
  614. break;}
  615. }
  616.  
  617.     /* while-loop: */
  618.   while(1)
  619.    { 
  620. a=x;
  621. b=y;
  622. while(1) {
  623. if (Joystick() & LEFT && x>5) {x--; ;break; } 
  624. if (Joystick() & RIGHT && x<36){x++;break;}
  625. if (Joystick() & UP && y>5){y--;break;}
  626. if (Joystick() & DOWN && y<20) y++;
  627. break;
  628. }
  629.  
  630. if (ReadPixel (my_window->RPort,x*6+4,y*8-2)==2) {Score=Score+10; n++;}
  631. if (ReadPixel (my_window->RPort,x*6+5,y*8-1)==6) {x=a;y=b;}
  632. if ((b!=y || a!=x) && ReadPixel (my_window->RPort,x*6+5,y*8-1)==5) Score++;
  633. Move (my_window->RPort,a*6,b*8);
  634. Text (my_window->RPort, " ",1);
  635. SetAPen(my_window->RPort,7);
  636. Move (my_window->RPort,x*6,y*8);
  637. Text (my_window->RPort, "&",1);   /* That's You */
  638. SetAPen(my_window->RPort,4);
  639. bs=Score;
  640. score[0]=(bs/10000)+48;bs=bs%10000;
  641. score[1]=(bs/1000)+48;bs=bs%1000;
  642. score[2]=(bs/100)+48;bs=bs%100;
  643. score[3]=(bs/10)+48;bs=bs%10;
  644. score[4]=bs+48;
  645. Move( my_window->RPort,78,8); Text( my_window->RPort, &score[0],5);
  646. Delay(1);
  647.  
  648. a=mx;b=my;mx=mx+xd;my=my+yd;
  649.  
  650. while (1) {
  651. if (mx==x && my==y) {Text (my_window->RPort, " ",1);break;}
  652. if (mx<5 || mx>36 || my>20 || my<5) {mx=a;my=b;Algo();break;}
  653. if ((ReadPixel (my_window->RPort,mx*6+5,my*8-1)!=0) || (ReadPixel (my_window->RPort,mx*6+3,my*8-2)!=0)) {mx=a;my=b;Algo();break;} 
  654.  
  655. if (xd!=0) {if (my<y) if ((ReadPixel (my_window->RPort,mx*6+5,my*8+7)==0) && (ReadPixel (my_window->RPort,mx*6+3,my*8+6)==0)) {yd=1;xd=0;break;}
  656.  
  657. if (my>y) if ((ReadPixel (my_window->RPort,mx*6+5,my*8-9)==0) && (ReadPixel (my_window->RPort,mx*6+3,my*8-10)==0)) {yd=-1;xd=0;
  658. break;} 
  659. break;
  660. }
  661.  
  662.  
  663. if (mx<x) if ((ReadPixel (my_window->RPort,mx*6+11,my*8-1)==0) && (ReadPixel (my_window->RPort,mx*6+9,my*8-2)==0)) {xd=1;yd=0;break;}
  664. if (mx>x) if ((ReadPixel (my_window->RPort,mx*6-1,my*8-1)==0) && (ReadPixel (my_window->RPort,mx*6-3,my*8-2)==0)) {xd=-1;yd=0;break;}
  665. break; 
  666. }
  667.  
  668. Move (my_window->RPort,a*6,b*8);
  669. Text (my_window->RPort, " ",1);
  670. SetAPen(my_window->RPort,3);
  671. Move (my_window->RPort,mx*6,my*8);
  672. Text (my_window->RPort, "'",1);    /* This is Zorak */
  673.  
  674. my_message = (struct IntuiMessage *) GetMsg(my_window->UserPort);
  675.     if (close)
  676.        break;
  677.  
  678.       /* After we have successfully collected the message we can read */
  679.       /* it, and save any important values which we maybe want to check */
  680.       /* later: */
  681.  
  682. if(my_message->Class == MENUPICK && my_message->Code == 63488)
  683. {Score=0;l=10;break;} /* New Game */
  684.  if(my_message->Class == MENUPICK && my_message->Code == 63520)
  685.  AutoRequest( my_window, &my_body_text, NULL, &my_ok_text, NULL, NULL, 220, 72);  /* About */
  686.  
  687.  if(my_message->Class == MENUPICK && my_message->Code == 63552)
  688.    {
  689. close=TRUE; /* Quit */
  690. break;}
  691.  
  692. if (mx==x && my==y) { SetAPen (my_window->RPort,7);
  693. Move (my_window->RPort,24,184);
  694. Text (my_window->RPort, "Kraj na igrata !",16);
  695. if (Score>hiscore[1]) {hiscore[1]=Score;
  696. SetAPen (my_window->RPort,3);
  697. Move (my_window->RPort,114,184);
  698. Text (my_window->RPort, "S now rekord !",14); Seek( file_handle, 0, OFFSET_BEGINNING );
  699. bytes_written=Write( file_handle, hiscore, sizeof( hiscore ) );
  700. for (i=1; i<500; i++)
  701. { my_message = (struct IntuiMessage *) GetMsg(my_window->UserPort);
  702.     if (close)
  703.        break;
  704.  
  705.       /* After we have successfully collected the message we can read */
  706.       /* it, and save any important values which we maybe want to check */
  707.       /* later: */
  708.  
  709. if((my_message->Class == MENUPICK && my_message->Code == 63488) || Joystick() & FIRE)
  710. {i=500;Score=0;l=10;break;} /* New Game */
  711.  if(my_message->Class == MENUPICK && my_message->Code == 63520)
  712.  AutoRequest( my_window, &my_body_text, NULL, &my_ok_text, NULL, NULL, 220, 72);  /* About */
  713.  
  714.  if(my_message->Class == MENUPICK && my_message->Code == 63552)
  715.    {
  716. close=TRUE; /* Quit */
  717. break;}
  718. Delay(1);}
  719. }
  720.  
  721. if (i==500) break;
  722. if (n==l) {if (l<35) l++;break;}
  723. Delay(1);
  724.   }
  725. }
  726. /* We should always close the screens we have opened before we leave: */
  727.  ClearMenuStrip( my_window );
  728.  
  729.  Close( file_handle );
  730.  
  731.  CloseWindow ( my_window ); 
  732.  
  733.  CloseScreen( my_screen );
  734.   
  735. /* Close the Graphics Library since we have opened it: */
  736.   CloseLibrary( GfxBase );
  737.  
  738.   /* Close the Intuition Library since we have opened it: */
  739.   CloseLibrary( IntuitionBase );
  740.  
  741.   /* THE END */
  742. exit();
  743. }
  744.  
  745. void Title() {
  746. UBYTE fl=128, fr=129;
  747. int i,j,b=0;
  748. SetAPen(my_window->RPort,2);
  749. for (i=1; i<30; i=i+2) {for (j=1; j<53; j=j+2) {Move( my_window->RPort,(j-b)*6,i*8); Text( my_window->RPort, &fl, 1 ); Move( my_window->RPort,(j-b)*6,(i+1)*8); Text( my_window->RPort, &fr, 1 );} if (b==0) b=-1; else b=0;}
  750. SetAPen(my_window->RPort,3);
  751. Move( my_window->RPort,102,120);
  752. Text( my_window->RPort, &Title1, 23 );
  753. Move( my_window->RPort,102,128);
  754. Text( my_window->RPort, &Title2, 23 );
  755. while (b<250) {b++;Delay(1); if (Joystick()==FIRE) b=255;}
  756.  
  757. }
  758. /* Joystick() is a handy, easy and fast but naughty function that hits */
  759. /* the hardware of the Amiga. It returns a bitfield containing the     */
  760. /* position of the stick and the present state of the button.          */
  761. /*                                                                     */
  762. /* Synopsis: value = Joystick();                                       */
  763. /*                                                                     */
  764. /* value:    (UBYTE) If the fire button is pressed, the first bit is   */
  765. /*           set. If the stick is moved to the right, the second bit   */
  766. /*           is set, and if the stick is moved to the left, the third  */
  767. /*           bit is set. The fourth bit is set if the stick is moved   */
  768. /*           down, and the fifth bit is set if the stick is moved up.  */
  769. /*           FIRE==1 RIGHT==2 LEFT==4 DOWN==8 UP==16                   */
  770.  
  771. UBYTE Joystick()
  772. {
  773.   UBYTE data = 0;
  774.   UWORD joy;
  775.   /* PORT 2 ("JOYSTICK PORT") */
  776.     joy = custom.joy1dat;
  777.     data += !( ciaa.ciapra & 0x0080 ) ? FIRE : 0;
  778.  
  779.   data += joy & 0x0002 ? RIGHT : 0;
  780.   data += joy & 0x0200 ? LEFT : 0;
  781.   data += (joy >> 1 ^ joy) & 0x0001 ? DOWN : 0;
  782.   data += (joy >> 1 ^ joy) & 0x0100 ? UP : 0;
  783.  
  784.   return( data );
  785. }
  786.  
  787. void Algo ()
  788. {
  789. while (1) {
  790. if (xd!=0) {if (my<20) if ((ReadPixel (my_window->RPort,mx*6+5,my*8+7)==0) && (ReadPixel (my_window->RPort,mx*6+3,my*8+6)==0)) {yd=1;xd=0;break;}
  791.  
  792. if (my>5) if ((ReadPixel (my_window->RPort,mx*6+5,my*8-9)==0) && (ReadPixel (my_window->RPort,mx*6+3,my*8-10)==0)) { yd=-1;xd=0; break;}
  793. xd=-xd;yd=-yd;break;}
  794.  
  795. if (mx<31) if ((ReadPixel (my_window->RPort,mx*6+11,my*8-1)==0) && (ReadPixel (my_window->RPort,mx*6+9,my*8-2)==0)) {xd=-1;yd=0;break;}
  796. xd=-xd;yd=-yd;break;
  797. }
  798.  
  799. }
  800.  
  801. /* Here comes the original AmigaBASIC code, which was written in 1995 The font now is included in the executable, and it's not external anymore. If you need cyrillic font for Amiga try:
  802. http://wuarchive.wustl.edu/~aminet/aminet/text/bfont/BTopaz.lha
  803.  
  804. SCREEN 1,337,256,4,1:WINDOW 1,"Venci",,1,1:PALETTE 0,0,0,0:PALETTE 1,0,0,0
  805. PALETTE 4,0,9/15,1
  806. PALETTE 9,1,0,0:PALETTE 10,1,1,0
  807. PALETTE 11,10/15,3/15,0
  808. PALETTE 15,0,0,1
  809. DECLARE FUNCTION AskSoftStyle& LIBRARY
  810. DECLARE FUNCTION OpenDiskFont& LIBRARY
  811. DECLARE FUNCTION Execute& LIBRARY
  812. LIBRARY "graphics.library"
  813. LIBRARY "diskfont.library"    
  814. Font "hap.font",8,0,0
  815. SUB Font(fontName$, height%, style%, prefs%) STATIC
  816.   SHARED pFont&                                            
  817.   IF pFont&<>0 THEN CALL CloseFont(pFont&)
  818.   fontName0$=fontName$+CHR$(0)
  819.   textAttr&(0)=SADD(fontName0$)
  820.   textAttr&(1)=height%*65536& + style%*256 + prefs%
  821.   pFont&=OpenDiskFont&(VARPTR(textAttr&(0)))
  822.   IF pFont& <> 0 THEN SetFont WINDOW(8),pFont&      
  823. END SUB
  824. E$="*":GOSUB Title
  825. 20 s=0:l=10
  826. 30 x=36:y=5:mx=l:my=5:xd=1:yd=0:n=0:CLS
  827. COLOR 8:LOCATE 1,4:PRINT "Rezultat";s:COLOR 9:LOCATE 1,24:PRINT  "Rekord"H
  828. COLOR 15:FOR i=4 TO 37:LOCATE 4,i:PRINT E$:LOCATE 21,41-i:PRINT E$
  829. LOCATE 2+i/2,4:PRINT E$:LOCATE 23-i/2,37:PRINT E$:NEXT
  830. t$="(":FOR i=1 TO 5:t$=t$+t$:NEXT:COLOR 14,1:FOR i=6 TO 20:LOCATE i,5:PRINT t$:NEXT
  831. FOR i=1 TO 20:COLOR 4,0:LOCATE 6+INT(RND(2)*14.9),5+INT(RND(2)*31.9):PRINT "*":NEXT
  832. COLOR 12,1:FOR i=1 TO l
  833. 100 b=6+INT(RND(2)*14.9):a=5+INT(RND(2)*31.9)
  834. 110 IF POINT(a*6-2,b*8-2)<>14 OR (a=36 AND b=6) THEN 100
  835. 120 LOCATE b,a:PRINT ")":NEXT:COLOR 0,0
  836. 130 COLOR 10:LOCATE y,x:PRINT "&":COLOR 9:LOCATE my,mx:PRINT "'"
  837. 140 IF STICK(2) OR STICK(3) THEN 150
  838. 145 GOTO 140
  839. 150 GOSUB 260
  840. 160 COLOR 8:LOCATE 1,13:PRINT s
  841. 170 GOSUB 350
  842. 180 IF mx=x AND my=y THEN 220
  843. 190 IF n<l THEN 150
  844. 200 IF l<35 THEN l=l+1
  845. 210 GOTO 30
  846. 220 COLOR 5:LOCATE 23,4:PRINT "Kraj na igrata !"
  847. 230 IF s>H THEN H=s:COLOR 6:LOCATE 23,19:PRINT "S now rekord !"
  848. 240 LOCATE 25,4:PRINT "O}e edna igra ? <D/N>"
  849. 241 t$=INKEY$:IF t$="N" OR t$="n" THEN 250
  850. 242 IF t$=" " OR t$="D" OR t$="d" OR t$="Y" OR t$="y" THEN 20 ELSE 241
  851. 250 SYSTEM                         
  852. 260 a=x:b=y:o=STICK(2):p=STICK(3)
  853. IF o<0 AND x>5 THEN x=x+o:GOTO 310
  854. IF o>0 AND x<36 THEN x=x+o:GOTO 310
  855. IF p>0 AND y<20 THEN y=y+p:GOTO 310
  856. IF p<0 AND y>5 THEN y=y+p
  857. 310 IF POINT(x*6-2,y*8-2)=12 THEN s=s+10:n=n+1
  858. IF POINT(x*6-1,y*8-1)=4 THEN x=a:y=b
  859. IF (b<>y OR a<>x) AND POINT(x*6-2,y*8-2)=14 THEN s=s+1
  860. LOCATE b,a:PRINT " ":COLOR 10:LOCATE y,x:PRINT "&":RETURN
  861. 350 a=mx:b=my:mx=mx+xd:my=my+yd
  862. IF mx=x AND my=y THEN PRINT " ":RETURN
  863. IF mx<5 OR mx>36 OR my>20 OR my<5 THEN mx=a:my=b:GOSUB 460:GOTO 420
  864. IF POINT(mx*6-2,my*8-1)<>0 THEN mx=a:my=b:GOSUB 460:GOTO 420
  865. 390 IF xd<>0 THEN GOTO 430
  866. 400 IF mx<x THEN IF POINT(mx*6+4,my*8-1)=0 THEN xd=1:yd=0
  867. IF mx>x THEN IF POINT(mx*6-8,my*8-1)=0 THEN xd=-1:yd=0
  868. 420 COLOR 0:LOCATE b,a:PRINT " ":COLOR 9:LOCATE my,mx:PRINT "'":RETURN
  869. 430 IF my<y THEN IF POINT(mx*6-1,my*8+7)=0 THEN yd=1:xd=0
  870. 440 IF my>y THEN IF POINT(mx*6-1,my*8-9)=0 THEN yd=-1:xd=0
  871. 450 GOTO 420
  872. 460 IF xd<>0 THEN GOTO 490
  873. IF mx<31 THEN IF POINT(mx*6+4,my*8-1)=0 THEN xd=-1:yd=0:RETURN
  874. 480 xd=-xd:yd=-yd:RETURN
  875. 490 IF my<20 THEN IF POINT(mx*6-1,my*8+7)=0 THEN yd=1:xd=0:RETURN
  876. IF my>5 THEN IF POINT(mx*6-1,my*8-9)=0 THEN yd=-1:xd=0:RETURN
  877. GOTO 480
  878. Title:
  879. CLS:COLOR 12:FOR i=1 TO 28 STEP 2
  880. FOR j=3 TO 53 STEP 2:LOCATE i,j-b:PRINT CHR$(128):LOCATE i+1,j-b:PRINT CHR$(129):NEXT:b=NOT b:NEXT
  881. FOR i=1 TO 23:READ a:a$=a$+CHR$(a+160):b$=b$+CHR$(a+161):NEXT
  882. COLOR 9:LOCATE 13,18:PRINT a$:LOCATE 14,18:PRINT b$
  883. Watt:
  884. i=i+1:IF i=5000 OR STICK(2) OR STICK(3) THEN RETURN ELSE Watt
  885. DATA 94,94,38,24,42,58,22,0,94,94,46,94,94,14,36,0,8,18,28,0,40,0,94
  886.  
  887. */ 
  888.